/*
 * rd_stats.h: Include file used to read system statistics
 * (C) 1999-2018 by Sebastien Godard (sysstat <at> orange.fr)
 */

#ifndef _RD_STATS_H
#define _RD_STATS_H

/*
 ***************************************************************************
 * Miscellaneous constants
 ***************************************************************************
 */

/* Get IFNAMSIZ */
#include <net/if.h>
#ifndef IFNAMSIZ
#define IFNAMSIZ	16
#endif

/* Maximum length of network interface name */
#define MAX_IFACE_LEN	IFNAMSIZ

/* Type for all functions counting items. Value can be negative (-1) */
#define __nr_t		int

/*
 ***************************************************************************
 * System files containing statistics
 ***************************************************************************
 */

/* Files */
#define NET_DEV			"/proc/net/dev"
#define UPTIME			"/proc/uptime"

#define EOPEN			-200
#define EREAD			-201
#define ECOUNTOVER		-202
#define EFORMAT			-203

/* Structure for network interfaces statistics */
struct stats_net_dev {
	unsigned long long rx_packets;
	unsigned long long tx_packets;
	unsigned long long rx_bytes;
	unsigned long long tx_bytes;
	unsigned long long rx_compressed;
	unsigned long long tx_compressed;
	unsigned long long multicast;
	unsigned int	   speed;
	char		   interface[MAX_IFACE_LEN];
	char		   duplex;
};


/*
 ***************************************************************************
 * Prototypes for functions used to read system statistics
 ***************************************************************************
 */

__nr_t read_net_dev
	(struct stats_net_dev *, __nr_t, U64 *);

#endif /* _RD_STATS_H */
